<HTML>
<CENTER><A HREF = "http://sparta.sandia.gov">SPARTA WWW Site</A> - <A HREF = "Manual.html">SPARTA Documentation</A> - <A HREF = "Section_commands.html#comm">SPARTA Commands</A> 
</CENTER>






<HR>

<H3>dump image command 
</H3>
<H3>dump movie command 
</H3>
<P><B>Syntax:</B>
</P>
<PRE>dump ID style mix-ID N file color diameter keyword value ... 
</PRE>
<UL><LI>ID = user-assigned name for the dump 

<LI>style = <I>image</I> or <I>movie</I> = style of dump command (other styles <I>particle</I> or <I>grid</I> or <I>surf</I> are discussed on the <A HREF = "dump.html">dump</A> doc page) 

<LI>mix-ID = mixture ID for which particles to include in image 

<LI>N = dump every this many timesteps 

<LI>file = name of file to write image to 

<LI>color = particle attribute that determines color of each particle 

<LI>diameter = particle attribute that determines size of each particle 

<LI>zero or more keyword/value pairs may be appended 

<LI>keyword = <I>particle</I> or <I>pdiam</I> or <I>grid</I> or <I>gridx</I> or <I>gridy</I> or <I>gridz</I> or <I>surf</I> or <I>size</I> or <I>view</I> or <I>center</I> or <I>up</I> or <I>zoom</I> or <I>persp</I> or <I>box</I> or <I>gline</I> or <I>sline</I> or <I>axes</I> or <I>shiny</I> or <I>ssao</I> 

<PRE>  <I>particle</I> = yes/no = do or do not draw particles
  <I>pdiam</I> value = number = numeric value for particle diameter (distance units)
  <I>grid</I> values = color
    color = <I>proc</I> or per-grid compute or fix
  <I>gridx</I> values = xcoord color
    xcoord = x value to dray yz plane of grid cells at
    color = <I>proc</I> or per-grid compute or fix
  <I>gridy</I> values = ycoord color
    ycoord = y value to dray xz plane of grid cells at
    color = <I>proc</I> or per-grid compute or fix
  <I>gridz</I> values = zcoord color
    zcoord = z value to dray xy plane of grid cells at
    color = <I>proc</I> or per-grid compute or fix
  <I>surf</I> values = color diam
    color = <I>one</I> or <I>proc</I> or per-surf compute or fix
    diam = diameter of 2d lines as fraction of shortest box length
  <I>size</I> values = width height = size of images
    width = width of image in # of pixels
    height = height of image in # of pixels
  <I>view</I> values = theta phi = view of simulation box
    theta = view angle from +z axis (degrees)
    phi = azimuthal view angle (degrees)
    theta or phi can be a variable (see below)
  <I>center</I> values = flag Cx Cy Cz = center point of image
    flag = "s" for static, "d" for dynamic
    Cx,Cy,Cz = center point of image as fraction of box dimension (0.5 = center of box)
    Cx,Cy,Cz can be variables (see below)
  <I>up</I> values = Ux Uy Uz = direction that is "up" in image
    Ux,Uy,Uz = components of up vector
    Ux,Uy,Uz can be variables (see below)
  <I>zoom</I> value = zfactor = size that simulation box appears in image
    zfactor = scale image size by factor > 1 to enlarge, factor < 1 to shrink
    zfactor can be a variable (see below)
  <I>persp</I> value = pfactor = amount of "perspective" in image
    pfactor = amount of perspective (0 = none, < 1 = some, > 1 = highly skewed)
    pfactor can be a variable (see below)
  <I>box</I> values = yes/no diam = draw outline of simulation box
    yes/no = do or do not draw simulation box lines
    diam = diameter of box lines as fraction of shortest box length
  <I>gline</I> values = yes/no diam = draw outline of each grid cell
    yes/no = do or do not draw grid cell outlines
    diam = diameter of grid outlines as fraction of shortest box length
  <I>sline</I> values = yes/no diam = draw outline of each surface element
    yes/no = do or do not draw surf element outlines
    diam = diameter of surf element outlines as fraction of shortest box length
  <I>axes</I> values = yes/no length diam = draw xyz axes
    yes/no = do or do not draw xyz axes lines next to simulation box
    length = length of axes lines as fraction of respective box lengths
    diam = diameter of axes lines as fraction of shortest box length
  <I>shiny</I> value = sfactor = shinyness of spheres and cylinders
    sfactor = shinyness of spheres and cylinders from 0.0 to 1.0
  <I>ssao</I> value = yes/no seed dfactor = SSAO depth shading
    yes/no = turn depth shading on/off
    seed = random # seed (positive integer)
    dfactor = strength of shading from 0.0 to 1.0 
</PRE>

</UL>
<P><B>Examples:</B>
</P>
<PRE>dump myDump image all 100 dump.*.jpg type type
dump myDump movie all 100 movie.mpg type type 
</PRE>
<P>These commands will dump shapshot images of all particles whose
species are in the <I>mix-ID</I> to a file every 100 steps.  The last two
shell command will make a movie from the JPG files (once the run has
finished) and play it in the Firefox browser:
</P>
<PRE>dump                4 image all 100 tmp.*.jpg type type pdiam 0.2 view 90 -90 
dump_modify	    4 pad 4
% convert tmp*jpg tmp.gif
% firefox tmp.gif 
</PRE>
<P><B>Description:</B>
</P>
<P>Dump a high-quality ray-traced image of the simulation every N
timesteps and save the images either as a sequence of JPEG or PNG or
PPM files, or as a single movie file.  The options for this command as
well as the <A HREF = "dump_modify.html">dump_modify</A> command control what is
included in the image and how it appears.
</P>
<P>Any or all of these entities can be included in the images:
</P>
<UL><LI>particles (all in mixture or limited to a <A HREF = "region.html">region</A>)
<LI>grid cells (all or limited to a <A HREF = "region.html">region</A>)
<LI>x,y,z planes cutting through the grid
<LI>surface elements 
</UL>
<P>Particles can be colored by any attribute allowed by the <A HREF = "dump.html">dump
particle</A> command.  Grid cells and the x,y,z cutting planes
can be colored by any per-grid attribute calculated by a
<A HREF = "compute.html">compute</A> or <A HREF = "fix.html">fix</A>.  Surface elements can be
colored by any per-surf attribute calculated by a
<A HREF = "compute.html">compute</A> or <A HREF = "fix.html">fix</A>.
</P>
<P>A series of images can easily be converted into an animated movie of
your simulation (see further details below), or the process can be
automated without writing the intermediate files using the dump movie
command.  Other dump styles store snapshots of numerical data
asociated with particles, grid cells, and surfaces in various formats,
as discussed on the <A HREF = "dump.html">dump</A> doc page.
</P>
<P>Here are two sample images, rendered as JPG files.  
Click to see the full-size images.
</P>
<DIV ALIGN=center>

<A HREF = "JPG/sphere_image.jpg"><IMG SRC = "JPG/sphere_image_small.jpg"></A>

<A HREF = "JPG/mix_sine.jpg"><IMG SRC = "JPG/mix_sine_small.jpg"></A>

</DIV>

<P>The left image is flow around a sphere with visualization of
triangular surface elements on the sphere surface (colored by surface
presssure), a vertical plane of grid cells (colored by particle
density), and a horizontal plane of particles (colored by chemical
species).  The right image is the initial condition for a 2d
simulation of Rayleigh-Taylor mixing as a relatively dense heavy gas
(red) mixes with a light gas (green), driven by gravity in the
downward direction.
</P>
<HR>

<P>The filename suffix determines whether a JPEG, PNG, or PPM file is
created with the <I>image</I> dump style.  If the suffix is ".jpg" or
".jpeg", then a JPEG format file is created, if the suffix is ".png",
then a PNG format is created, else a PPM (aka NETPBM) format file is
created.  The JPEG and PNG files are binary; PPM has a text mode
header followed by binary data.  JPEG images have lossy compression;
PNG has lossless compression; and PPM files are uncompressed but can
be compressed with gzip, if SPARTA has been compiled with
-DSPARTA_GZIP and a ".gz" suffix is used.
</P>
<P>Similarly, the format of the resulting movie is chosen with the
<I>movie</I> dump style.  This is handled by the underlying FFmpeg
converter program, which must be available on your machine, and thus
details have to be looked up in the FFmpeg documentation.  Typical
examples are: .avi, .mpg, .m4v, .mp4, .mkv, .flv, .mov, .gif
Additional settings of the movie compression like bitrate and
framerate can be set using the <A HREF = "dump_modify.html">dump_modify</A> command.
</P>
<P>To write out JPEG and PNG format files, you must build SPARTA with
support for the corresponding JPEG or PNG library.  To convert images
into movies, SPARTA has to be compiled with the -DSPARTA_FFMPEG flag.
See <A HREF = "Section_start.html#start_2">Section 2.2</A> of the manual for
instructions on how to do this.
</P>
<HR>

<P>Dumps are performed on timesteps that are a multiple of N, including
timestep 0.  Note that this means a dump will not be performed on the
initial timestep after the dump command is invoked, if the current
timestep is not a multiple of N.  This behavior can be changed via the
<A HREF = "dump_modify.html">dump_modify first</A> command.  N can be changed
between runs by using the <A HREF = "dump_modify.html">dump_modify every</A>
command.
</P>
<P>Dump <I>image</I> filenames must contain a wildcard character "*", so that
one image file per snapshot is written.  The "*" character is replaced
with the timestep value.  For example, tmp.dump.*.jpg becomes
tmp.dump.0.jpg, tmp.dump.10000.jpg, tmp.dump.20000.jpg, etc.  Note
that the <A HREF = "dump_modify.html">dump_modify pad</A> command can be used to
insure all timestep numbers are the same length (e.g. 00010), which
can make it easier to convert a series of images into a movie in the
correct ordering.
</P>
<P>Dump <I>movie</I> filenames on the other hand, must not have any wildcard
character since only one file combining all images into a single movie
will be written by the movie encoder.
</P>
<HR>

<P>Several of the keywords determine what objects are rendered in the
image, namely particles, grid cells, or surface elements.  There are
additional optional kewords which control how the image is rendered.
As listed below, all of the keywords have defaults, most of which you
will likely not need to change.  The <A HREF = "dump_modify.html">dump modify</A>
also has options specific to the dump image style, particularly for
assigning colors to particles and other image features.
</P>
<HR>

<H4>Rendering of particles 
</H4>
<P>Particles are drawn by default using the <I>color</I> and <I>diameter</I>
settings.  The <I>particle</I> keyword allow you to turn off the drawing of
all particles, if the specified value is <I>no</I>.  Only particles in a
geometric region can be drawn using the <A HREF = "dump_modify.html">dump_modify
region</A> command.
</P>
<P>The <I>color</I> and <I>diameter</I> settings determine the color and size of
particles rendered in the image.  They can be any particle attribute
defined for the <A HREF = "dump.html">dump particle</A> command, including <I>type</I>.
</P>
<P>The <I>diameter</I> setting can be overridden with a numeric value by the
optional <I>pdiam</I> keyword, in which case you can specify the <I>diameter</I>
setting with any valid particle attribute.  The <I>pdiam</I> keyword
overrides the <I>diameter</I> setting with a specified numeric value.  All
particles will be drawn with that diameter, e.g. 1.5, which is in
whatever distance <A HREF = "units.html">units</A> the input script defines.
</P>
<P>If <I>type</I> is specified for the <I>color</I> setting, then the color of each
particle is determined by its type = species index.  By default the
mapping of types to colors is as follows:
</P>
<UL><LI>type 1 = red
<LI>type 2 = green
<LI>type 3 = blue
<LI>type 4 = yellow
<LI>type 5 = aqua
<LI>type 6 = purple 
</UL>
<P>and repeats itself for types > 6.  This mapping can be changed by the
<A HREF = "dump_modify.html">dump_modify pcolor</A> command.
</P>
<P>If <I>proc</I> is specified for the <I>color</I> setting, then the color of each
particle is determined by the ID of the owning processor.  The default
mapping of proc IDs to colors is that same as in the list above,
except that proc P corresponds to type P+1.
</P>
<P>If <I>type</I> is specified for the <I>diameter</I> setting then the diameter of
each particle is determined by its type = species index.  By default
all types have diameter 1.0.  This mapping can be changed by the
<A HREF = "dump_modify.html">dump_modify adiam</A> command.
</P>
<P>If <I>proc</I> is specified for the <I>diameter</I> setting then the diameter of
each particle will be the proc ID (0 up to Nprocs-1) in whatever
<A HREF = "units.html">units</A> you are using, which is undoubtably not what you
want.
</P>
<P>Any of the particle attributes listed in the <A HREF = "dump.html">dump custom</A>
command can also be used for the <I>color</I> or <I>diameter</I> settings.  They
are interpreted in the following way.
</P>
<P>If "vx", for example, is used as the <I>color</I> setting, then the color
of the particle will depend on the x-component of its velocity.  The
association of a per-particle value with a specific color is
determined by a "color map", which can be specified via the
<A HREF = "dump_modify.html">dump_modify cmap</A> command.  The basic idea is that
the particle-attribute will be within a range of values, and every
value within the range is mapped to a specific color.  Depending on
how the color map is defined, that mapping can take place via
interpolation so that a value of -3.2 is halfway between "red" and
"blue", or discretely so that the value of -3.2 is "orange".
</P>
<P>If "vx", for example, is used as the <I>diameter</I> setting, then the
particle will be rendered using the x-component of its velocity as the
diameter.  If the per-particle value <= 0.0, them the particle will not be
drawn. 
</P>
<HR>

<H4>Rendering of grid cells 
</H4>
<P>The <I>grid</I> keyword turns on the drawing of grid cells with the
specified color attribute.  For 2d, the grid cell is shaded with an
rectangle that is infinitely thin in the z dimension, which allows you
to still see the particles in the grid cell.  For 3d, the grid cell is
drawn as a solid brick, which will obscure the particles inside it.
</P>
<P>Only grid cells in a geometric region can be drawn using the
<A HREF = "dump_modify.html">dump_modify region</A> command.
</P>
<P>The <I>gridx</I> and <I>gridy</I> and <I>gridz</I> keywords turn on the drawing of of
a 2d plane of grid cells at the specified coordinate.  This is a way
to draw one or more slices through a 3d image.
</P>
<P>The <A HREF = "dump_modify.html">dump_modify region</A> command does not apply
to the <I>gridx</I> and <I>gridy</I> and <I>gridz</I> plane drawing.
</P>
<P>If <I>proc</I> is specified for the <I>color</I> setting, then the color of each
grid cell is determined by its owning processor ID.  This is useful
for visualizing the result of a load balancing of the grid cells,
e.g. by the <A HREF = "balance_grid.html">balance_grid</A> or <A HREF = "fix_balance.html">fix
balance</A> commands.  By default the mapping of proc
IDs to colors is as follows:
</P>
<UL><LI>proc ID 1 = red
<LI>proc ID 2 = green
<LI>proc ID 3 = blue
<LI>proc ID 4 = yellow
<LI>proc ID 5 = aqua
<LI>proc ID 6 = purple 
</UL>
<P>and repeats itself for IDs > 6.  Note that for this command, processor
IDs range from 1 to Nprocs inclusive, instead of the more customary 0
to Nprocs-1.  This mapping can be changed by the <A HREF = "dump_modify.html">dump_modify
gcolor</A> command.
</P>
<P>The <I>color</I> setting can also be a per-grid compute or fix.  In this
case, it is specified as <I>c_ID</I> or <I>c_ID[N]</I> for a compute and as
<I>f_ID</I> and <I>f_ID[N]</I> for a fix.
</P>
<P>This allows per grid cell values in a vector or array to be used to
color the grid cells.  The ID in the attribute should be replaced by
the actual ID of the compute or fix that has been defined previously
in the input script.  See the <A HREF = "compute.html">compute</A> or <A HREF = "fix.html">fix</A>
command for details.
</P>
<P>If <I>c_ID</I> is used as a attribute, then the per-grid vector calculated
by the compute is used.  If <I>c_ID[N]</I> is used, then N must be in the
range from 1-M, which will use the Nth column of the per-grid array
calculated by the compute.
</P>
<P>If <I>f_ID</I> is used as a attribute, then the per-grid vector calculated
by the fix is used.  If <I>f_ID[N]</I> is used, then N must be in the
range from 1-M, which will use the Nth column of the per-grid array
calculated by the fix.
</P>
<P>The manner in which values in the vector or array are mapped to color
is determined by the <A HREF = "dump_modify.html">dump_modify cmap</A> command.
</P>
<HR>

<H4>Rendering of surface elements 
</H4>
<P>The <I>surf</I> keyword turns on the drawing of surface elements with the
specified color attribute.  For 2d, the surface element is a line
whose diameter is specified by the <I>diam</I> setting as a fraction of the
minimum simulation box length.  For 3d it is a triangle and the <I>diam</I>
setting is ignored.  The entire surface is rendered, which in 3d will
hide any grid cells (or fractions of a grid cell) that are inside the
surface.
</P>
<P>The <A HREF = "dump_modify.html">dump_modify region</A> command does not apply to
surface element drawing.
</P>
<P>If <I>one</I> is specified for the <I>color</I> setting, then the color of every
surface element is drawn with the color specified by the <A HREF = "dump_modify.html">dump_modify
scolor</A> keyword, which is gray by default.
</P>
<P>If <I>proc</I> is specified for the <I>color</I> setting, then the color of each
surface element is determined by its owning processor ID.  Surface
elements are assigned to owning processors in a round-robin fashion.
By default the mapping of proc IDs to colors is as follows:
</P>
<UL><LI>proc ID 1 = red
<LI>proc ID 2 = green
<LI>proc ID 3 = blue
<LI>proc ID 4 = yellow
<LI>proc ID 5 = aqua
<LI>proc ID 6 = purple 
</UL>
<P>and repeats itself for IDs > 6.  Note that for this command, processor
IDs range from 1 to Nprocs inclusive, instead of the more customary 0
to Nprocs-1.  This mapping can be changed by the <A HREF = "dump_modify.html">dump_modify
scolor</A> command, which has not yet been added to
SPARTA.
</P>
<P>The <I>color</I> setting can also be a per-surf compute or fix.  In this
case, it is specified as <I>c_ID</I> or <I>c_ID[N]</I> for a compute and as
<I>f_ID</I> and <I>f_ID[N]</I> for a fix.
</P>
<P>This allows per-surf values in a vector or array to be used to color
the surface elemtns.  The ID in the attribute should be replaced by
the actual ID of the compute or fix that has been defined previously
in the input script.  See the <A HREF = "compute.html">compute</A> or <A HREF = "fix.html">fix</A>
command for details.
</P>
<P>If <I>c_ID</I> is used as a attribute, then the per-surf vector calculated
by the compute is used.  If <I>c_ID[N]</I> is used, then N must be in the
range from 1-M, which will use the Nth column of the per-surf array
calculated by the compute.
</P>
<P>If <I>f_ID</I> is used as a attribute, then the per-surf vector calculated
by the fix is used.  If <I>f_ID[N]</I> is used, then N must be in the
range from 1-M, which will use the Nth column of the per-surf array
calculated by the fix.
</P>
<P>The manner in which values in the vector or array are mapped to color
is determined by the <A HREF = "dump_modify.html">dump_modify cmap</A> command.
</P>
<HR>

<HR>

<P>The <I>size</I> keyword sets the width and height of the created images,
i.e. the number of pixels in each direction.
</P>
<HR>

<P>The <I>view</I>, <I>center</I>, <I>up</I>, <I>zoom</I>, and <I>persp</I> values determine how
3d simulation space is mapped to the 2d plane of the image.  Basically
they control how the simulation box appears in the image.
</P>
<P>All of the <I>view</I>, <I>center</I>, <I>up</I>, <I>zoom</I>, and <I>persp</I> values can be
specified as numeric quantities, whose meaning is explained below.
Any of them can also be specified as an <A HREF = "variable.html">equal-style
variable</A>, by using v_name as the value, where "name" is
the variable name.  In this case the variable will be evaluated on the
timestep each image is created to create a new value.  If the
equal-style variable is time-dependent, this is a means of changing
the way the simulation box appears from image to image, effectively
doing a pan or fly-by view of your simulation.
</P>
<P>The <I>view</I> keyword determines the viewpoint from which the simulation
box is viewed, looking towards the <I>center</I> point.  The <I>theta</I> value
is the vertical angle from the +z axis, and must be an angle from 0 to
180 degrees.  The <I>phi</I> value is an azimuthal angle around the z axis
and can be positive or negative.  A value of 0.0 is a view along the
+x axis, towards the <I>center</I> point.  If <I>theta</I> or <I>phi</I> are
specified via variables, then the variable values should be in
degrees.
</P>
<P>The <I>center</I> keyword determines the point in simulation space that
will be at the center of the image.  <I>Cx</I>, <I>Cy</I>, and <I>Cz</I> are
speficied as fractions of the box dimensions, so that (0.5,0.5,0.5) is
the center of the simulation box.  These values do not have to be
between 0.0 and 1.0, if you want the simulation box to be offset from
the center of the image.  Note, however, that if you choose strange
values for <I>Cx</I>, <I>Cy</I>, or <I>Cz</I> you may get a blank image.  Internally,
<I>Cx</I>, <I>Cy</I>, and <I>Cz</I> are converted into a point in simulation space.
If <I>flag</I> is set to "s" for static, then this conversion is done once,
at the time the dump command is issued.  If <I>flag</I> is set to "d" for
dynamic then the conversion is performed every time a new image is
created.  If the box size or shape is changing, this will adjust the
center point in simulation space.
</P>
<P>The <I>up</I> keyword determines what direction in simulation space will be
"up" in the image.  Internally it is stored as a vector that is in the
plane perpendicular to the view vector implied by the <I>theta</I> and
<I>pni</I> values, and which is also in the plane defined by the view
vector and user-specified up vector.  Thus this internal vector is
computed from the user-specified <I>up</I> vector as
</P>
<PRE>up_internal = view cross (up cross view) 
</PRE>
<P>This means the only restriction on the specified <I>up</I> vector is that
it cannot be parallel to the <I>view</I> vector, implied by the <I>theta</I> and
<I>phi</I> values.
</P>
<P>The <I>zoom</I> keyword scales the size of the simulation box as it appears
in the image.  The default <I>zfactor</I> value of 1 should display an
image mostly filled by the particles in the simulation box.  A <I>zfactor</I> >
1 will make the simulation box larger; a <I>zfactor</I> < 1 will make it
smaller.  <I>Zfactor</I> must be a value > 0.0.
</P>
<P>The <I>persp</I> keyword determines how much depth perspective is present
in the image.  Depth perspective makes lines that are parallel in
simulation space appear non-parallel in the image.  A <I>pfactor</I> value
of 0.0 means that parallel lines will meet at infininty (1.0/pfactor),
which is an orthographic rendering with no persepctive.  A <I>pfactor</I>
value between 0.0 and 1.0 will introduce more perspective.  A <I>pfactor</I>
value > 1 will create a highly skewed image with a large amount of
perspective.
</P>
<P>IMPORTANT NOTE: The <I>persp</I> keyword is not yet supported as an option.
</P>
<HR>

<P>The <I>box</I> keyword determines how the simulation box boundaries are
rendered as thin cylinders in the image.  If <I>no</I> is set, then the box
boundaries are not drawn and the <I>diam</I> setting is ignored.  If <I>yes</I>
is set, the 12 edges of the box are drawn, with a diameter that is a
fraction of the shortest box length in x,y,z (for 3d) or x,y (for 2d).
The color of the box boundaries can be set with the <A HREF = "dump_modify.html">dump_modify
boxcolor</A> command.
</P>
<P>The <I>gline</I> keyword determines how the outlines of grid cells are
rendered as thin cylinders in the image.  If the <I>gridx</I> or <I>gridy</I> or
<I>gridz</I> keywords are specified to draw a plane(s) of grid cells, then
outlines of all cells in the plane(s) are drawn.  If the planar
options are not used, then the outlines of all grid cells are drawn,
whether the <I>grid</I> keyword is specified or not.  In this case, the
<A HREF = "dump_modify.html">dump_modify region</A> command can be used to restrict
which grid cells the outlines are drawn for.
</P>
<P>For the <I>gline</I> keywork, if <I>no</I> is set, then grid outlines are not
drawn and the <I>diam</I> setting is ignored.  If <I>yes</I> is set, the 12
edges of each grid cell are drawn, with a diameter that is a fraction
of the shortest box length in x,y,z (for 3d) or x,y (for 2d).  The
color of the grid cell outlines can be set with the <A HREF = "dump_modify.html">dump_modify
glinecolor</A> command.
</P>
<P>The <I>sline</I> keyword determines how the outlines of surface elements
are rendered as thin cylinders in the image.  If <I>no</I> is set, then the
surface element outlines are not drawn and the <I>diam</I> setting is
ignored.  If <I>yes</I> is set, a line is drawn for 2d and a triangle
outline for 3d surface elements, with a diameter that is a fraction of
the shortest box length in x,y,z (for 3d) or x,y (for 2d).  The color
of the surface element outlines can be set with the <A HREF = "dump_modify.html">dump_modify
slinecolor</A> command.
</P>
<P>The <I>axes</I> keyword determines how the coordinate axes are rendered as
thin cylinders in the image.  If <I>no</I> is set, then the axes are not
drawn and the <I>length</I> and <I>diam</I> settings are ignored.  If <I>yes</I> is
set, 3 thin cylinders are drawn to represent the x,y,z axes in colors
red,green,blue.  The origin of these cylinders will be offset from the
lower left corner of the box by 10%.  The <I>length</I> setting determines
how long the cylinders will be as a fraction of the respective box
lengths.  The <I>diam</I> setting determines their thickness as a fraction
of the shortest box length in x,y,z (for 3d) or x,y (for 2d).
</P>
<HR>

<P>The <I>shiny</I> keyword determines how shiny the objects rendered in the
image will appear.  The <I>sfactor</I> value must be a value 0.0 <=
<I>sfactor</I> <= 1.0, where <I>sfactor</I> = 1 is a highly reflective surface
and <I>sfactor</I> = 0 is a rough non-shiny surface.
</P>
<P>The <I>ssao</I> keyword turns on/off a screen space ambient occlusion
(SSAO) model for depth shading.  If <I>yes</I> is set, then particles
further away from the viewer are darkened via a randomized process,
which is perceived as depth.  The calculation of this effect can
increase the cost of computing the image by roughly 2x.  The strength
of the effect can be scaled by the <I>dfactor</I> parameter.  If <I>no</I> is
set, no depth shading is performed.
</P>
<HR>

<P>A series of JPEG, PNG, or PPM images can be converted into a movie
file and then played as a movie using commonly available tools.  Using
dump style <I>movie</I> automates this step and avoids the intermediate
step of writing (many) image snapshot file.
</P>
<P>To manually convert JPEG, PNG or PPM files into an animated GIF or
MPEG or other movie file you can:
</P>
<UL><LI>a) Use the ImageMagick convert program. 

<PRE>% convert *.jpg foo.gif
% convert -loop 1 *.ppm foo.mpg 
</PRE>
<P>Animated GIF files from ImageMagick are unoptimized. You can use a
program like gifsicle to optimize and massively shrink them.
MPEG files created by ImageMagick are in MPEG-1 format with rather
inefficient compression and low quality.
</P>
<LI>b) Use QuickTime. 

<P>Select "Open Image Sequence" under the File menu Load the images into
QuickTime to animate them Select "Export" under the File menu Save the
movie as a QuickTime movie (*.mov) or in another format.  QuickTime
can generate very high quality and efficiently compressed movie
files. Some of the supported formats require to buy a license and some
are not readable on all platforms until specific runtime libraries are
installed.
</P>
<LI>c) Use FFmpeg  

<P>FFmpeg is a command line tool that is available on many platforms and
allows extremely flexible encoding and decoding of movies.
</P>
<PRE>cat snap.*.jpg | ffmpeg -y -f image2pipe -c:v mjpeg -i - -b:v 2000k movie.m4v
cat snap.*.ppm | ffmpeg -y -f image2pipe -c:v ppm -i - -b:v 2400k movie.avi 
</PRE>
<P>Frontends for FFmpeg exist for multiple platforms. For more
information see the <A HREF = "http://www.ffmpeg.org/">FFmpeg homepage</A>
</P>

</UL>
<HR>

<P>You can play a movie file as follows:
</P>
<UL><LI>a) Use your browser to view an animated GIF movie. 

<P>Select "Open File" under the File menu
Load the animated GIF file
</P>
<LI>b) Use the freely available mplayer or ffplay tool to view a
movie. Both are available for multiple OSes and support a large
variety of file formats and decoders. 

<PRE>% mplayer foo.mpg 
% ffplay bar.avi 
</PRE>
<LI>c) Use the <A HREF = "http://www.sandia.gov/~sjplimp/pizza.html">Pizza.py</A>
<A HREF = "http://www.sandia.gov/~sjplimp/pizza/doc/animate.html">animate tool</A>,
which works directly on a series of image files. 

<PRE>a = animate("foo*.jpg") 
</PRE>
<LI>d) QuickTime and other Windows- or MacOS-based media players can
obviously play movie files directly. Similarly for corresponding tools
bundled with Linux desktop environments.  However, due to licensing
issues with some file formats, the formats may require installing
additional libraries, purchasing a license, or may not be
supported. 
</UL>
<HR>

<P><B>Restrictions:</B>
</P>
<P>To write JPEG images, you must use the -DSPARTA_JPEG switch when
building SPARTA and link with a JPEG library. To write PNG images, you
must use the -DSPARTA_PNG switch when building SPARTA and link with a
PNG library.
</P>
<P>To write <I>movie</I> files, you must use the -SPARTA_FFMPEG switch when
building SPARTA.  The FFmpeg executable must also be available on the
machine where SPARTA is being run.  Typically it's name is lowercase,
i.e. ffmpeg.
</P>
<P>See <A HREF = "Section_start.html#start_2_2">Section 2.2.2</A> section of the
documentation for details on how to compile with optional switches.
</P>
<P>Note that since FFmpeg is run as an external program via a pipe,
SPARTA has limited control over its execution and no knowledge about
errors and warnings printed by it. Those warnings and error messages
will be printed to the screen only. Due to the way image data is
communicated to FFmpeg, it will often print the message + pipe::
Input/output error :pre + which can be safely ignored. Other warnings
and errors have to be addressed according to the FFmpeg documentation.
One known issue is that certain movie file formats (e.g. MPEG level 1
and 2 format streams) have video bandwith limits that can be crossed
when rendering too large of image sizes. Typical warnings look like
this:
</P>
<PRE>[mpeg @ 0x98b5e0] packet too large, ignoring buffer limits to mux it
[mpeg @ 0x98b5e0] buffer underflow st=0 bufi=281407 size=285018
[mpeg @ 0x98b5e0] buffer underflow st=0 bufi=283448 size=285018 
</PRE>
<P>In this case it is recommended to either reduce the size of the image
or encode in a different format that is also supported by your copy of
FFmpeg, and which does not have this limitation (e.g. .avi, .mkv,
mp4).
</P>
<P><B>Related commands:</B>
</P>
<P><A HREF = "dump.html">dump</A>, <A HREF = "dump_modify.html">dump_modify</A>, <A HREF = "undump.html">undump</A>
</P>
<P><B>Default:</B>
</P>
<P>The defaults for the keywords are as follows:
</P>
<UL><LI>particle = yes
<LI>pdiam = not specified (use diameter setting)
<LI>grid = not specified (no drawing of grid cells)
<LI>gridx = not specified (no drawing of x-plane of grid cells)
<LI>gridy = not specified (no drawing of y-plane of grid cells)
<LI>gridz = not specified (no drawing of z-plane of grid cells)
<LI>surf = not specified (no drawing of surface elements)
<LI>size = 512 512
<LI>view = 60 30 (for 3d)
<LI>view = 0 0 (for 2d)
<LI>center = s 0.5 0.5 0.5
<LI>up = 0 0 1 (for 3d)
<LI>up = 0 1 0 (for 2d)
<LI>zoom = 1.0
<LI>persp = 0.0
<LI>box = yes 0.02
<LI>gline = no 0.0
<LI>sline = no 0.0
<LI>axes = no 0.0 0.0
<LI>shiny = 1.0
<LI>ssao = no 
</UL>
</HTML>
